package cn.wolfcode.rbac.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {
    private int code;// 状态码:200成功,500失败
    private String msg;// 响应提示的信息
    private Object data;// 响应的具体内容
    public static R ok() {
        return new R(200, "操作成功", null);
    }
    public static R ok(String msg, Object data) {
        return new R(200, msg, data);
    }
    public static R ok(Object data) {
        return new R(200, "操作成功", data);
    }
    public static R fail() {
        return new R(500, "系统繁忙", null);
    }
    public static R fail(String msg) {
        return new R(500, msg,null);
    }
    public static R fail(int code,String msg) {
        return new R(code, msg,null);
    }
}
